import request from "@/utils/index.js";

// 获取招聘信息数据接口
export const getPostAPI = () => {
  return request({
    url: "/api/ports",
    method: "get",
  });
};

// 新增招聘信息接口
export const addPostAPI = ({
  trade_name,
  address,
  industry,
  people_scale,
  post_name,
  education,
  salary,
}) => {
  return request({
    url: "/api/addPort",
    method: "post",
    data: {
      trade_name,
      address,
      industry,
      people_scale,
      post_name,
      education,
      salary,
    },
  });
};

// 修改招聘信息接口
export const updatePostAPI = ({
  id,
  trade_name,
  address,
  industry,
  people_scale,
  post_name,
  education,
  salary,
}) => {
  return request({
    url: "/api/updatePort",
    method: "post",
    data: {
      id,
      trade_name,
      address,
      industry,
      people_scale,
      post_name,
      education,
      salary,
    },
  });
};

// 删除招聘信息接口
export const delPostAPI = (id) => {
  return request({
    url: "/api/delPort/" + id,
    method: "get",
  });
};
// 收藏数据接口
export const updateStateAPI = (id) => {
  return request({
    url: "/api/updateState/" + id,
    method: "post",
  });
};
// 取消收藏数据接口
export const updateNoStateAPI = (id) => {
  return request({
    url: "/api/updateNoState/" + id,
    method: "post",
  });
};

// 获取收藏数据接口
export const getStateAPI = () => {
  return request({
    url: "/api/getState",
    method: "get",
  });
};
